import request from '../../utils/request'
import { requestString } from '../../utils/request'
import {download} from '../../utils/commons'

/**
 * 分页查询注册会员客户
 */
export async function queryRegCustomers({ cstName, cstType, vipType, status, page }) {
    return request(apiPath.vipmc + "/api/vipCst", {
        method: 'GET',
        data: { cstName, cstType, vipType, status, page: page.page, size: page.size }
    });
}

/**
 * 分页查询财税发送记录
 */
export async function queryFinanceRecords({ cstName, page }) {
    return request(apiPath.vipmc + "/api/vipCst/financeRecods", {
        method: 'GET',
        data: { cstName, page: page.page, size: page.size }
    });
}

/**
 * 分页查询开票信息
 */
export async function queryInvoiceRecords({cstName, page}) {
    return request(apiPath.vipmc + "/api/vipCst/invoiceRecord", {
        method: 'GET',
        data: { cstName,page:page.page,size: page.size }
    });
}

/**
 * 根据id获取开票信息详情
 */
export async function getInvoiceRecords({ id }) {
    return request(apiPath.vipmc + "/api/vipCst/invoiceRecord/" + id, {
        method: 'get'
    });
}

/**
 * 删除开票信息
 */
export async function deleteInvoiceRecords({ id }) {
    return request(apiPath.vipmc + "/api/vipCst/invoiceRecord/" + id, {
        method: 'DELETE',
    });
}

/**
 * 修改开票信息
 */
export async function updateInvoiceRecord({invoiceInfo}) {
    return requestString(apiPath.vipmc + "/api/vipCst/invoiceRecord", {
        method: 'PUT',
        data: {...invoiceInfo}
    });
}


/**
 * 根据id获取会员客户详情
 */
export async function getRegCustomer({ id }) {
    return request(apiPath.vipmc + "/api/vipCst/" + id, {
        method: 'get'
    });
}

/**
 * 删除会员客户
 */
export async function deleteRegCustomer({ id }) {
    return request(apiPath.vipmc + "/api/vipCst/" + id, {
        method: 'DELETE',
    });
}

/**
 * 修改会员客户
 */
export async function updateRegCustomer({regCustomer}) {
    return requestString(apiPath.vipmc + "/api/vipCst", {
        method: 'PUT',
        data: {...regCustomer}
    });
}

/**
 * 转移会员客户
 */
export async function transferRegCustomer({ id }) {
    return request(apiPath.vipmc + "/api/vipCst/transfer/" + id, {
        method: 'PUT',
    });
}

/**
 * 发送财税附件邮件
 */
export async function sendFinance({sendInfo}) {
    return requestString(apiPath.vipmc + "/api/vipCst/financeSend", {
        method: 'PUT',
        data: {...sendInfo}
    });
}

/**
 * 导出注册会员客户
 */
export async function exportRegCustomers({ cstName, cstType, vipType, status }) {
    download(apiPath.vipmc + "/api/vipCst/export", {cstName, cstType, vipType, status});
}

/**
 * 查询会员产品列表
 *
 */
export async function queryGoods() {
    return request(apiPath.vipmc + "/api/vipCst/goods", {
        method: 'GET'
    });
}